var uuid = require('uuid');
// var client = require('../../app/jms/jms.client');

var jmsConfig = require('../../app/config/jms.config')
var Stomp = require('stomp-client');
var queue = jmsConfig.jms.merchant_queueName;

function webJms(req,res,next){
    console.log('11111');
    console.log(req.body);
    var merchant = {
        _id:'051641a4-cfa2-480c-bc47-5c420c8f54a4',
        account:'jim',
        name:'好吃点uuu1',
        address:'软件园路31',
        imgHead:'/gg1/gg.jpg',
        imgCard:'/hh1/ff.jpg',
    }
    var pro = {
        result:true,
        data:req.body
    }
    var client = new Stomp(jmsConfig.jms.host,jmsConfig.jms.port,jmsConfig.jms.username,jmsConfig.jms.password);
    client.destination = queue;
    client.connect(function(){
        console.log('msg->'+JSON.stringify(pro));
        client.publish(client.destination,JSON.stringify(pro));
        // setInterval(function(){
        //     client.publish(queue,JSON.stringify(pro));
        // },2000);
        client.disconnect();


    });
    res.send('success');
}

module.exports = webJms;



